﻿/// <summary>
/// AbsESF_MetaObject【IESF_Clone接口】
/// </summary>
public partial class AbsESF_MetaObject : IESF_Clone
{
    #region IESF_Clone
    /// <summary>
    /// 从From对象克隆
    /// </summary>
    /// <param name="_from">指定对象</param>
    public void CloneFrom(IESF_Clone _from)
    {
        OnBeforeCloneFrom(this, _from);
        OnCloneFrom(_from);
        OnAfterCloneFrom(this, _from);
    }

    /// <summary>
    /// 克隆
    /// </summary>
    /// <returns>克隆后对象</returns>
    public IESF_Clone Clone()
    {
        OnBeforeClone(this);
        IESF_Clone result = OnClone();
        OnAfterClone(result);
        return result;
    }

    /// <summary>
    /// 克隆之前
    /// </summary>
    /// <param name="_self">自身</param>
    protected virtual void OnBeforeClone(IESF_Clone _self) { }

    /// <summary>
    /// 克隆
    /// </summary>
    /// <returns>自身克隆</returns>
    protected virtual IESF_Clone OnClone() { return null; }

    /// <summary>
    /// 克隆之后
    /// </summary>
    /// <param name="_self">自身</param>
    protected virtual void OnAfterClone(IESF_Clone _self) { }

    /// <summary>
    /// CloneFrom之前事件
    /// </summary>
    /// <param name="_self">自身</param>
    /// <param name="_from">克隆源</param>
    protected virtual void OnBeforeCloneFrom(IESF_Clone _self, IESF_Clone _from) { }

    /// <summary>
    /// 从From对象克隆
    /// </summary>
    /// <param name="_from">源对象</param>
    protected virtual void OnCloneFrom(IESF_Clone _from) { }

    /// <summary>
    /// CloneFrom之后事件   
    /// </summary>
    /// <param name="_self">自身</param>
    /// <param name="_from">克隆源</param>
    protected virtual void OnAfterCloneFrom(IESF_Clone _self, IESF_Clone _from) { }
    #endregion
}
